package com.efrei.schoolmanager.model.obj;

import java.io.Serializable;

import com.efrei.schoolmanager.exceptions.LogicException;

public class Note implements Serializable {
	private static final long serialVersionUID = 4594114574764877503L;
	
	/** Attributes */
	private int noteId;
	private Eleve eleve;
	private Classe classe;
	private Matiere matiere;
	private int periode;
	private int numControle;
	private float note;

	public Note() {
	}

	public Note(Eleve eleve, Classe classe, Matiere matiere,
			int periode, int numControle, float note) {
		super();
		this.eleve = eleve;
		this.classe = classe;
		this.matiere = matiere;
		this.periode = periode;
		this.numControle = numControle;
		this.note = note;
	}
	
	@Override
	public String toString() {
		String sep = " - ";
		return new StringBuilder()
			.append("Periode:").append(periode)
			.append("-Controle:").append(numControle)
			.append("-Note:").append(note)
			.append(sep).append(eleve)
			.append(sep).append(classe)
			.append(sep).append(matiere)
			.toString();
	}

	public int getNoteId() {
		return noteId;
	}

	public void setNoteId(int noteId) {
		this.noteId = noteId;
	}

	public Eleve getEleve() {
		return eleve;
	}

	public void setEleve(Eleve eleve) {
		this.eleve = eleve;
	}

	public Classe getClasse() {
		return classe;
	}

	public void setClasse(Classe classe) {
		this.classe = classe;
	}

	public Matiere getMatiere() {
		return matiere;
	}

	public void setMatiere(Matiere matiere) {
		this.matiere = matiere;
	}

	public int getPeriode() {
		return periode;
	}

	public void setPeriode(int periode) {
		this.periode = periode;
	}

	public int getNumControle() {
		return numControle;
	}

	public void setNumControle(int numControle) {
		this.numControle = numControle;
	}

	public float getNote() {
		return note;
	}

	public void setNote(float note) throws LogicException {
		if(note >=0)
			this.note = note;
		else
			throw new LogicException("Note negative");
	}
}

